#include "Logger.h"
#include "../String.h"
#include "../Types.h"

#ifdef RZ_INCLUDE_LOGGER

namespace Rz { namespace Diagnostics {

void Logger::Log(const char* format, ...)
{
	va_list argList;
	va_start(argList, format);
	vfprintf(_stream, format, argList);
	fprintf(_stream, "\n");
	va_end(argList);
}

void Logger::LogTrace(const char* filename, int line, const char* fn, const char* format, ...)
{
	va_list argList;
	va_start(argList, format);

	fprintf(_stream, "[%s(%i):%s] ", filename, line, fn);
	vfprintf(_stream, format, argList);
	fprintf(_stream, "\n");

	va_end(argList);
}

void Logger::SetOutputStream(FILE* stream)
{
	_stream = stream;
}

Logger::Logger() :
	_stream(stderr)
{

}

} }

#endif
